package org.caro.actions;

import org.caro.actions.message.ReceiveMessage;
import org.caro.actions.message.SendMessage;
import org.caro.actions.play.ReceivePlayChess;
import org.caro.actions.play.SendPlayChess;
import org.caro.actions.transfer.ControlGame;
import org.caro.utils.Constants;

public class ContestantAction {
	private String home;
	private String away;
	private int mode;
	public static boolean turn = false;
	private SendMessage chatSend;
	private ReceiveMessage chatRecv;
	private SendPlayChess playSend;
	private ReceivePlayChess playRecv;
	private ControlGame controlSend,controlRecv;
	
	public SendMessage getChatSend() {
		return chatSend;
	}

	public void setChatSend(SendMessage chatSend) {
		this.chatSend = chatSend;
	}

	public ReceiveMessage getChatRecv() {
		return chatRecv;
	}

	public void setChatRecv(ReceiveMessage chatRecv) {
		this.chatRecv = chatRecv;
	}

	public SendPlayChess getPlaySend() {
		return playSend;
	}

	public void setPlaySend(SendPlayChess playSend) {
		this.playSend = playSend;
	}

	public ReceivePlayChess getPlayRecv() {
		return playRecv;
	}

	public void setPlayRecv(ReceivePlayChess playRecv) {
		this.playRecv = playRecv;
	}

	public int getmode() {
		return mode;
	}

	public void setmode(int mode) {
		this.mode = mode;
	}

	


	public String getHome() {
		return home;
	}

	public void setHome(String home) {
		this.home = home;
	}

	public String getAway() {
		return away;
	}

	public void setAway(String away) {
		this.away = away;
	}

	public ContestantAction(String home, String away,boolean turn, int mode, String host,
			int portChatSend, int portChatRecv, int portPlaySend,
			int portPlayRecv,ControlGame controlSend,ControlGame controlRecv) throws Exception{
		this(home,away,mode,home,portChatSend,portChatRecv,portPlaySend,portPlayRecv);
		ContestantAction.turn = true;
		this.controlSend = controlSend;
		this.controlRecv = controlRecv;
	}
	
	public ControlGame getControlSend() {
		return controlSend;
	}

	public ControlGame getControlRecv() {
		return controlRecv;
	}

	public ContestantAction(String home, String away, int mode, String host,
			int portChatSend, int portChatRecv, int portPlaySend,
			int portPlayRecv) throws Exception {
		this.home = home;
		this.away = away;
		this.mode = mode;
		if (this.mode == Constants.HOST) turn = true;
		this.chatSend = new SendMessage(host, portChatSend, mode);
		this.chatRecv = new ReceiveMessage(host, portChatRecv, mode);
		this.playSend = new SendPlayChess(host, portPlaySend, mode);
		this.playRecv = new ReceivePlayChess(host, portPlayRecv, mode);
	}

	
	/*
	public void hitSendToPlayer(Position position,ActionZonePanel actionZone) throws ConnectionException{
		if (mode == Constants.HOST) actionZone.getButton(position).setIcon(new ImageIcon(Constants.IMAGE_PLAYER_1));
		else actionZone.getButton(position).setIcon(new ImageIcon(Constants.IMAGE_PLAYER_2));
		actionZone.setMapButton(position, mode);
		playSend.sendPositionPlay(position);
	}
	public void hitRecvFromPlayer(ActionZonePanel actionZone) throws ConnectionException {
		playRecv.receivePositionPlay(actionZone);
	}
	*/

}
